{Hint: save all files to location: \jni }
unit MainModule;

{$mode delphi}

interface

uses
  Classes, SysUtils, AndroidWidget, Laz_And_Controls, gridview, And_jni;
  
type

  { TMainCtrModule }

  { TMainForm }

  TMainForm = class(jForm)
    jGrdFunctions: jGridView;
    jPanTitle: jPanel;
    jTexTitle: jTextView;
    procedure jGrdFunctionsClickItem(Sender: TObject; ItemIndex: integer; itemCaption: string);
    procedure MainFormActivityCreate(Sender: TObject; intentData: jObject);
    procedure MainFormCloseQuery(Sender: TObject; var CanClose: boolean);

  private
    {private declarations}
  public
    {public declarations}
  end;

var
  MainForm: TMainForm;

implementation
uses KaoqModule,CstmModule;
{$R *.lfm}

procedure TMainForm.MainFormActivityCreate(Sender: TObject; intentData: jObject );
begin
  jGrdFunctions.Add('考勤查询', 'f001');  //from:  ../res/drawable
  jGrdFunctions.Add('客户资料', 'f002');
  jGrdFunctions.Add('完工查询', 'f003');
  jGrdFunctions.Add('来料库存', 'f004');
  jGrdFunctions.Add('正在生产', 'f005');


end;

procedure TMainForm.jGrdFunctionsClickItem(Sender: TObject; ItemIndex: integer; itemCaption: string);
begin
  case ItemIndex of
  0:if KaoqForm = nil then
    begin
      gApp.CreateForm(TKaoqForm, KaoqForm);
      KaoqForm.Init(gApp);
    end else
    begin
     KaoqForm.Show;
    end;
  1:if CstmForm = nil then
    begin
      gApp.CreateForm(TCstmForm, CstmForm);
      CstmForm.Init(gApp);
    end else
    begin
     CstmForm.ReInit(gApp);
    end;
  2: ShowMessage(itemCaption);
  3: ShowMessage(itemCaption);
  4: ShowMessage(itemCaption);
  end;
end;


procedure TMainForm.MainFormCloseQuery(Sender: TObject; var CanClose: boolean);
begin
  gApp.Finish;
end;


end.
